package com.web.demo.controller;

import com.web.demo.model.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


/**
 * web api result 风格url
 */
@Slf4j
@RestController
public class UserController {

    @GetMapping(value = "getUser")
    public User getUser() {
        User user = new User();
        user.setAge(18);
        user.setName("张三");
        user.setSex("男");
        //return "获取-用户";
        log.info("log info age: {} name: {} sex: {}", user.getAge(), user.getName(), user.getSex());
        return user;
    }

    @RequestMapping(value = "addUser", method = RequestMethod.PUT)
    public String addUser() {

        return "新增-用户";
    }

    @RequestMapping(value = "updateUser", method = RequestMethod.POST)
    public String updateUser() {

        return "修改-用户";
    }

    @RequestMapping(value = "deleteUser", method = RequestMethod.DELETE)
    public String deleteUser() {

        return "删除-用户";
    }

}
